function DelLam=equas3(mu,sigma,T,lambda1,lambda2,w1,w2,w3)

g1=(lambda1*w1^(1-sigma)+lambda2*(w2*T)^(1-sigma)+(1-lambda1-lambda2)*(w3*T)^(1-sigma))^(1/(1-sigma));
    g2=(lambda1*(w1*T)^(1-sigma)+lambda2*w2^(1-sigma)+(1-lambda1-lambda2)*(w3*T)^(1-sigma))^(1/(1-sigma));
    g3=(lambda1*(w1*T)^(1-sigma)+lambda2*(w2*T)^(1-sigma)+(1-lambda1-lambda2)*w3^(1-sigma))^(1/(1-sigma));
    
    y1=mu*lambda1*w1+(1-mu)/3;
    y2=mu*lambda2*w2+(1-mu)/3;
    y3=mu*(1-lambda1-lambda2)*w3+(1-mu)/3;
    
    InW1=(y1*g1^(sigma-1)+y2*g2^(sigma-1)*T^(1-sigma)+y3*g3^(sigma-1)*T^(1-sigma))^(1/sigma);
    InW2=(y1*g1^(sigma-1)*T^(1-sigma)+y2*g2^(sigma-1)+y3*g3^(sigma-1)*T^(1-sigma))^(1/sigma);
    InW3=(y1*g1^(sigma-1)*T^(1-sigma)+y2*g2^(sigma-1)*T^(1-sigma)+y3*g3^(sigma-1))^(1/sigma);

while w1-InW1>=0.01 || w2-InW2>=0.01 || w3-InW3>=0.01
    w1=InW1;
    w2=InW2;
    w3=InW3;
    
    g1=(lambda1*w1^(1-sigma)+lambda2*(w2*T)^(1-sigma)+(1-lambda1-lambda2)*(w3*T)^(1-sigma))^(1/(1-sigma));
    g2=(lambda1*(w1*T)^(1-sigma)+lambda2*w2^(1-sigma)+(1-lambda1-lambda2)*(w3*T)^(1-sigma))^(1/(1-sigma));
    g3=(lambda1*(w1*T)^(1-sigma)+lambda2*(w2*T)^(1-sigma)+(1-lambda1-lambda2)*w3^(1-sigma))^(1/(1-sigma));
    
    y1=mu*lambda1*w1+(1-mu)/3;
    y2=mu*lambda2*w2+(1-mu)/3;
    y3=mu*(1-lambda1-lambda2)*w3+(1-mu)/3;
    
    InW1=(y1*g1^(sigma-1)+y2*g2^(sigma-1)*T^(1-sigma)+y3*g3^(sigma-1)*T^(1-sigma))^(1/sigma);
    InW2=(y1*g1^(sigma-1)*T^(1-sigma)+y2*g2^(sigma-1)+y3*g3^(sigma-1)*T^(1-sigma))^(1/sigma);
    InW3=(y1*g1^(sigma-1)*T^(1-sigma)+y2*g2^(sigma-1)*T^(1-sigma)+y3*g3^(sigma-1))^(1/sigma);
end

omega1=w1*g1^(-mu);
omega2=w2*g2^(-mu);
omega3=w3*g3^(-mu);
MeaOme=lambda1*omega1+lambda2*omega2+(1-lambda1-lambda2)*omega3;
DelLam(1,1)=(omega1-MeaOme)*lambda1;
DelLam(2,1)=(omega2-MeaOme)*lambda2;
DelLam(3,1)=(omega3-MeaOme)*(1-lambda1-lambda2);
